// import axios from 'axios'

// const https = axios.create({
//   baseURL: 'https://webservices.autotask.net',
//   timeout: 1000 * 180,
//   withCredentials: true,
//   proxy: {
//     host: 'https://webservices.autotask.net',
//     port: 443
//   }
// })

// const apiBefore = ''
import http from '@/utils/request'

const apiBefore = '/other'

export const other = {
  getAutoTaskBaseUrlApi: params => {
    return http.get(`${apiBefore}/atservicesrest/v1.0/zoneInformation`, { params })
  },
  getLoginConfigInfo: params => {
    if(window.location.hostname === 'localhost'){
      return http.get(`${apiBefore}/apigateway/api/dataset/1640894768406925313`, { params })
    }
    else{
      return http.get(`/apigateway/api/dataset/1640894768406925313`, { params })
    }
  },
  getApiToolDeleteData: params => {
    return http.get(`web/dm/sync/customize/${params.tenantCode}/delete`, { params })
  }

}

/**
 * @param { String } method
 * @param { String } url
 * @param { Object } params
 */
export const customRequest = (method, url, params) => {
  let newRequest = null
  switch (method) {
    case 'GET':
      newRequest = http.get(url, { params })
      break
    case 'POST':
      newRequest = http.post(url, params)
      break
    case 'PUT':
      newRequest = http.put(url, params)
      break
    case 'DELETE':
      newRequest = http.delete(url, params)
      break

    default:
      newRequest = http.get(url, { params })
      break
  }
  return newRequest
}
